<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>某某家具设计公司企业官网-模板之家</title> ﻿
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta name="viewport"
	content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="alternate icon" type="image/png" href="images/favicon.png">
<link rel='icon' href='favicon.ico' type='image/x-ico' />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" href="css/default.min.css?t=227" />
<!--[if (gte IE 9)|!(IE)]><!-->
<script type="text/javascript" src="lib/jquery/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="lib/amazeui/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script type="text/javascript" src="lib/handlebars/handlebars.min.js"></script>
<script type="text/javascript" src="lib/iscroll/iscroll-probe.js"></script>
<script type="text/javascript" src="lib/amazeui/amazeui.min.js"></script>
<script type="text/javascript" src="lib/raty/jquery.raty.js"></script>
<script type="text/javascript" src="js/main.min.js?t=1"></script>
</head>
<body>
	<jsp:include page="header.jsp" />
	<div>
		<header class="header-article-list">
		<h1>在线留言</h1>

		</header>
		<div>
			<form class="message-form" method="post">

				<label>姓名 <input type="text" name="username" id="username">
					<span>*</span>
				</label> <label>电话 <input type="text" name="tel" id="tel"> <span>*</span>
				</label> <label>邮箱 <input type="email" name="email" id="email">
					<span>*</span>
				</label> <label>内容 <textarea id="content"></textarea> <span>*</span>
				</label>


				<button type="button" onclick="addMsg()"
					class="am-btn am-btn-danger">提交</button>
			</form>
		</div>
	</div>
	﻿<jsp:include page="footer.jsp" />
</body>
<script type="text/javascript">
     <!-- 使用JQuery来提交数据 -->
     function addMsg(){
    	 //获取用户输入的留言信息
    	 var username = $("#username").val();   
    	 var tel = $("#tel").val(); 
    	 var email = $("#email").val(); 
    	 var content = $("#content").val(); 
    	 //封装参数
    	 var param = {
    		"username":username,
    		"tel":tel,
    		"email":email,
    		"content":content
    	 };
    	 //调用接口
    	 var url = "MessageServlet?url=addMsg";
    	 $.post(url,param,function(res){
    		 //处理接口返回结果的函数
    		 if(res.success){
    			 alert(res.message);
    		 }else{
    			 alert(res.message);
    		 }
    		 
    	 },"json");
    	      
     }
</script>
</html>